<%= post.error_messages %>
<%= post.text_field :title, label:  t(".title"), class:  "span6" %>
<%= post.text_area :content, label:  t(".content"), class:  "span12 ckeditor", id: "post_content" %>
<%= post.text_field :url, label:  raw(t(".url.caption", default_url: "#{DateTime.now.year}/#{t(".url.generated_title")}", root: monologue.root_path)) %>
<%= post.text_field :published_at, label:  t(".published_at"), data: {datepicker: "datepicker"}, value: post.object.published_at.nil? ? "" : post.object.published_at.strftime("%Y-%m-%d") %>
<%= post.text_field :tag_list, label:  raw(t(".tags")) %>
<%= post.check_box :published, label:  t(".published") %>

<div class="form-actions">
  <%= post.button t(".save"), class:  "btn btn-large btn-primary" %> 
  <%= post.button t(".preview"), class: "btn btn-large", type: "button", value: "preview"%>
</div>

<div class="post-preview modal-backdrop hide" data-url="<%=admin_post_preview_url%>" data-toggle="post-preview" data-trigger="button[value='preview']">
  <div class="post-preview-inner">
    <div class="navbar pull-right">
      <div class="navbar-inner">
        <span class="brand"><%=t(".preview")%></span> 
        <a class="btn btn-primary pull-right" data-dismiss="post-preview"><%=t(".close")%></a>
      </div>
    </div>
  </div>
  <iframe src="" name="preview"></iframe>
</div>

<script>
  if($.fn.datepicker.defaults_<%= I18n.locale %>){
    $.fn.datepicker.defaults = $.fn.datepicker.defaults_<%= I18n.locale %>;
  }
  $("#post_tag_list").select2({tags: <%= Monologue::Tag.all.map{|t| t.name }.to_json.html_safe %> });
</script>